#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
const LL mod = 1e9 + 7;
string s;
int main()
{
	cin >> s;
	LL ans = 1;
	bool flag = 0;
	for (int i = 0; i < s.size() / 2; i++) {
		if (s[i] == s[s.size() - i - 1]) {
			if (s[i] == '?') {
				ans *= 26;
				ans %= mod;
			}
		}
		else if ((s[i] == '?' && s[s.size() - i - 1]!='?') ||
		(s[i] != '?' && s[s.size() - i - 1] == '?')) {
			continue;
		}
		else {
			ans = 0;
			flag = 1;
			break;
		}
	}
	if (s[s.size()/2] == '?' && (s.size() & 1)) {
		ans *= 26;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}